﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Zhuang.Model.EF;

namespace Zhuang.WebSite.App_Code.Common
{
    public class SessionHelper
    {
        static SessionHelper()
        {
            HttpContext.Current.Session.Timeout = 1800;
        }

        public static Sys_User GetUser()
        {
            return HttpContext.Current.Session["curUser"] as Sys_User;
        }

        public static void SetUser(Sys_User user)
        {
            HttpContext.Current.Session["curUser"] = user;

        }

        public static void SetUserMenus(List<Sys_Menu> userMenus)
        {
            HttpContext.Current.Session["userMenus"] = userMenus;
        }

        public static List<Sys_Menu> GetUserMenus()
        {
            return (HttpContext.Current.Session["userMenus"]) as List<Sys_Menu>;
        }
    }
}